
var ctxPath =  "http://localhost:8080/rest/v1.0/"

var jeecg = {
    ajaxJson: function (url, option, callback) {
        $.ajax(ctxPath+url, {

            method: 'POST',
            data: option,
            success: function (data) {

                    callback(data);

            },
            error: function(e){
                layer.msg("请求出现异常,请联系管理员");
            },
            complete: function () {

            }
        });
    },
    ajaxJsonGet: function (url, option, callback) {
        $.ajax(ctxPath+url, {

            method: 'GET',
            data: option,
            success: function (data) {

                callback(data);

            },
            error: function(e){
                layer.msg("请求出现异常,请联系管理员");
            },
            complete: function () {

            }
        });
    },
    ajaxJsonDel: function (url, option, callback) {
        $.ajax(ctxPath+url, {

            method: 'DELETE',
            data: option,
            success: function (data) {

                callback(data);

            },
            error: function(e){
                layer.msg("请求出现异常,请联系管理员");
            },
            complete: function () {

            }
        });
    },
    ajaxJsonSync: function (url, option, callback) {
        $.ajax(url, {
            async: false,

            type: 'post',
            data: option,
            success: function (data) {
                //坚持登录
                if (!jeecg.checkLogin(data)) {
                    return false;
                }
                if ($.isFunction(callback)) {
                    callback(data);
                }
            },
            error: function (response, textStatus, errorThrown) {

            },
            complete: function () {

            }
        });
    }
}




